package com.bridgeintelligent.tag.bulkload.api;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by JackCheung on 2019/9/8 8:53 PM.
 */
@Data
public class DimInfo implements Serializable, Cloneable {

    //标签id
    private String dimId;
    //标签名
    private String dimName;
    //标签类型
    private DimType dimType;
    //标签展示类型
    private String dimeShowType;
    private String dimDataType;

    public enum DimType {
        //基础标签，自定义标签，我的标签
        COMMON_DIM(1, "COMMON"),
        FREE_DIM(2, "FREE"),
        QUANTITATIVE_DIM(3, "QUANTITATIVE");
        private static final Map<String, DimType> stringToEnum = new HashMap<>();

        DimType(int code, String name) {
        }

        static {
            for (DimType fieldType : values()) {
                stringToEnum.put(fieldType.toString(), fieldType);
            }
        }

        //根据code返回标签类型对象
        public static DimType getInstance(String code) {
            return stringToEnum.get(code);
        }
    }
}
